/**
 * 开发环境（地址不要有生产的连接信息）
 * window.sz.ddLogin 是否开启钉钉登录，true开启，false 关闭（内网环境修改位false，否则加载慢）在配置文件最后
 * */

var globalConf = {};
function setGlobalConf(NODE_ENV) {
  switch (NODE_ENV) {
    case "development":
      {
        console.log("本地-开发环境");
        // let ipAdd = "192.168.1.19"; //本地
        let ipAdd = "124.70.215.191"; // 测试

        // let ipAdd = "172.20.10.2";  // 测试
        // let ipAdd = "123.6.56.160";// 正式
        // let ipAdd = "192.168.1.14"; // 测试
        // let ipAdd = "124.89.83.235"; // 测试
        let wpsAssistNameTem = "WpsOAAssist_nt_test"; // wps加载项名称 测试
        let etAssistNameTem = "EtOAAssist_nt_test"; // wps加载项名称 测试
        let port = ":23886";
        globalConf = {
          domain: {
            api: "//" + ipAdd + port + "/api",
            image1: "http://" + ipAdd + port + "/",
            image: "http://" + ipAdd + ":8848",
            uploadUrl: "http://" + ipAdd + port + "/api/file/upload/name",
            uploadUrl1: "http://" + ipAdd + port + "/api/sys/file/upload/",
            uploadExeUrl:
              "http://" + ipAdd + port + "/api/bak/assist/activity/info/excel/",
            sysUploadUrl: "http://" + ipAdd + port + "/api/sys/file/db/upload",
            wpsUploadUrl: "http://" + ipAdd + port + "/api/wps/upload/",
            secretFilePreview: "http://" + ipAdd + port + "/api/sys/file/",
            // preFile: "http://preview.sanzhisoft.com/onlinePreview",
            preFile: "http://" + ipAdd + ":8012/onlinePreview",
            codeUrl: "http://" + ipAdd + port + "/api/auth/code",
            serverUrl: "http://" + ipAdd + port + "/api/ueditor/config",
            socketUrl: "ws://" + ipAdd + port + "/ws/",
            ddAppId: "dingoalnut6s3wzeiuc7p3",
            ddRedirect: "http://" + ipAdd + ":8990/#/login/ding"
          },
          wps: {
            wpsAssistName: wpsAssistNameTem,
            wpsAssistUrl: "http://" + ipAdd + ":8990/WpsOAAssist/",
            wpsNotice: "http://" + ipAdd + port + "/api/wps/state/",
            etAssistName: etAssistNameTem,
            etAssistUrl: "http://" + ipAdd + ":8990/EtOAAssist/",
            etNotice: "http://" + ipAdd + port + "/api/wps/state/auth/",
            etUploadUrl: "http://" + ipAdd + port + "/api/wps/assembly/upload/"
          },
          needAuth: true
        };
      }
      break;
    case "production":
      {
        console.log("测试服-生产环境");
        let ipAdd = "124.70.215.191"; // 测试
        // let ipAdd = "localhost"; // 测试
        // let ipAdd = "192.168.1.130"; // 测试
        // let ipAdd = "123.6.56.160"; // 测试
        
        // let ipAdd = "192.168.1.19";//本地
        // let ipAdd = "124.89.83.235"; // 测试
        let wpsAssistNameTem = "WpsOAAssist_nt_test"; // wps加载项名称 测试
        let etAssistNameTem = "EtOAAssist_nt_test"; // wps加载项名称 测试
        let port = ":23886";
        globalConf = {
          domain: {
            api: "//" + ipAdd + port + "/api",
            image: "http://" + ipAdd + ":8848",
            image1: "http://" + ipAdd + port + "/",
            uploadUrl: "http://" + ipAdd + port + "/api/file/upload/name",
            uploadUrl1: "http://" + ipAdd + port + "/api/sys/file/upload/",
            uploadExeUrl:
              "http://" + ipAdd + port + "/api/bak/assist/activity/info/excel/",
            sysUploadUrl: "http://" + ipAdd + port + "/api/sys/file/db/upload",
            wpsUploadUrl: "http://" + ipAdd + port + "/api/wps/upload/",
            secretFilePreview: "http://" + ipAdd + port + "/api/sys/file/",
            // preFile: "http://preview.sanzhisoft.com/onlinePreview",
            preFile: "http://" + ipAdd + ":8012/onlinePreview",
            codeUrl: "http://" + ipAdd + port + "/api/auth/code",
            serverUrl: "http://" + ipAdd + port + "/api/ueditor/config",
            socketUrl: "ws://" + ipAdd + port + "/ws/",
            ddAppId: "dingoalnut6s3wzeiuc7p3",
            ddRedirect: "http://" + ipAdd + ":8990/#/login/ding"
          },
          wps: {
            wpsAssistName: wpsAssistNameTem,
            wpsAssistUrl: "http://" + ipAdd + ":8990/WpsOAAssist/",
            wpsNotice: "http://" + ipAdd + port + "/api/wps/state/",
            etAssistName: etAssistNameTem,
            etAssistUrl: "http://" + ipAdd + ":8990/EtOAAssist/",
            etNotice: "http://" + ipAdd + port + "/api/wps/state/auth/",
            etUploadUrl: "http://" + ipAdd + port + "/api/wps/assembly/upload/"
          },
          needAuth: true
        };
      }
      break;
  }
  localStorage.setItem("previewUrl", globalConf.domain.image);
  localStorage.setItem("baseUrl", globalConf.domain.api);
  globalConf.appTitle = "办公平台";
  globalConf.loginSuccessRoute = { name: "admin" };
  window.api = {};
  window.api.domain = globalConf.domain.api; //接口api
  window.api.image = globalConf.domain.image; //图片、附件前缀
  window.api.image1 = globalConf.domain.image1; //图片、附件前缀
  window.api.codeUrl = globalConf.domain.codeUrl; // 请求验证吗地址
  window.api.imageDomain = globalConf.domain.image; //图片、附件前缀
  window.api.uploadUrl = globalConf.domain.uploadUrl; // 一般文件上传地址
  window.api.uploadExeUrl = globalConf.domain.uploadExeUrl; // 一般文件上传地址
  window.api.uploadUrl1 = globalConf.domain.uploadUrl1; // 一般文件上传地址
  window.api.sysUploadUrl = globalConf.domain.sysUploadUrl; // 文件流上传地址
  window.api.secretFilePreview = globalConf.domain.secretFilePreview; // 文件流预览前缀
  window.api.preFile = globalConf.domain.preFile; // 预览地址（在线预览）
  window.api.wpsUploadUrl = globalConf.domain.wpsUploadUrl; // wps保存地址
  window.api.serverUrl = globalConf.domain.serverUrl; //ueditor 配置服务地址
  window.api.socketUrl = globalConf.domain.socketUrl; //socket 地址
  window.api.ddAppId = globalConf.domain.ddAppId; //钉钉appId
  window.api.ddRedirect = globalConf.domain.ddRedirect; //钉钉重定向地址
  window.web = globalConf.domain.web; // 前端网页地址（暂时不用）
  window.wps = {};
  window.wps.wpsAssistName = globalConf.wps.wpsAssistName; // wps插件名称
  window.wps.wpsAssistUrl = globalConf.wps.wpsAssistUrl; // wps插件名称
  window.wps.wpsNotice = globalConf.wps.wpsNotice; // wps插件文档状态改变通知地址
  window.wps.etAssistName = globalConf.wps.etAssistName; // et插件名称
  window.wps.etAssistUrl = globalConf.wps.etAssistUrl; // et插件名称
  window.wps.etNotice = globalConf.wps.etNotice; // et插件文档状态改变通知地址
  window.wps.etUploadUrl = globalConf.wps.etUploadUrl; // et插件文档状态改变通知地址
  window.sz = {};
  window.sz.ddLogin = true; //是否开启钉钉登录，true开启，false 关闭（内网环境修改位false，否则加载慢）
  window.sz.ico = "favicon.ico"; //标签栏角标，默认为favicon.ico，更换请设置对应ico文件名
  window.sz.controlMeeting = true; //会议议题是否显示
  window.globalConf = globalConf;
}

// module.exports = globalConf;
